#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include <windows.h>
#include <strsafe.h>
#include <Windows.h>
#include <mmsystem.h>
#include "Location.h"


class MyCam
{
public:
	MyCam(void);
	~MyCam(void);
	D3DXMATRIX* GetViewMatrix();
	D3DXMATRIX* GetProjectionMatrix();
	void Update();
	void SetViewParams(D3DXVECTOR3* vEyePt, D3DXVECTOR3* vLookatPt);
	void SetProjParams(float n_fFOV, float n_fAspect, float n_fNearPlane, float n_fFarPlane);
	D3DXVECTOR3 getPos();
	LRESULT HandleMessages(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	
private:
	D3DXVECTOR3 vEye;					// Eye Vector
	D3DXVECTOR3 vLookat;				// Lookat Vector
	D3DXVECTOR3 vPosition;				// Position vector of the camera
	D3DXVECTOR3 vPosDelta;				// Position change of the camera
	D3DXVECTOR3 vUp;					// The up vector for the camera
	D3DXVECTOR3 vMove;					// MovementDirection
	D3DXMATRIX mView;					// View matrix 
	D3DXMATRIX mWorld;					// World matrix inverse of view 
    D3DXMATRIX mProj;					// Projection matrix
	float fFOV;							// Field of view
	float fAspect;						// Aspect ratio
	float fNearPlane;					// Near clipping plane
	float fFarPlane;					// Far clipping plane
	float fMoveScale;					// Scaler controling movement speed
	float fPitchAng;					// Pitch angle
	float fYawAng;						// Yaw Angle
	bool bCamChanged;					// Stores if the camera has rotated or moved sence we last computed the matricies

	void MoveForward(float Dist);		// Moves the camera forward or backward the value of Dist
	void MoveRight(float Dist);			// Moves the camera left or right the value of Dist
	void MoveUp(float Dist);			// Moves the camera up or down
	void Yaw(float Angle);				// Rotates the camera's Yaw 
	void Pitch(float Angle);			// Rotates the camera's Pitch
	void SetPos(D3DXVECTOR3 *Pos);		// Sets the camera position to the input
	

};
